<?php
/**
 * Created by PhpStorm.
 * Script Name: BotBase.php
 * Create: 2023/2/13 13:57
 * Description:
 * Author: fudaoji<fdj@kuryun.cn>
 */

namespace plugin\wechat\app\tenant\controller;


use plugin\wechat\app\TenantController;

class BotBase extends TenantController
{
    public function __construct()
    {
        parent::__construct();
    }

    public function __get($name)
    {
        $request = \request();
        switch ($name){
            case 'bot':
                return $request->botInfo;
                break;
        }
        return null;
    }

    /**
     * 获取当前操作机器人的信息
     * @param null $key
     * @return mixed|null
     * Author: fudaoji<fdj@kuryun.cn>
     */
    protected function getCurrentBot($key = null){
        $bot = request()->botInfo;
        return $key!==null ? $bot[$key] : $bot;
    }
}